using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class mail_level_reward : MangosBase
	{
		public System.Byte? level;
		public System.UInt32? racemask;
		public System.UInt32? mailtemplateid;
		public System.UInt32? senderentry;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `mail_level_reward` (`level`, `racemask`, `mailtemplateid`, `senderentry`) VALUES ('{0}', '{1}', '{2}', '{3}');", level.GetValueOrDefault(), racemask.GetValueOrDefault(), mailtemplateid.GetValueOrDefault(), senderentry.GetValueOrDefault());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `mail_level_reward` SET ");
			if(racemask != null)
			{
				sb.AppendLine("`racemask`='" + racemask.Value.ToString() + "'");
			}
			if(mailtemplateid != null)
			{
				sb.AppendLine("`mailtemplateid`='" + mailtemplateid.Value.ToString() + "'");
			}
			if(senderentry != null)
			{
				sb.AppendLine("`senderentry`='" + senderentry.Value.ToString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `level`='" + level.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
